package rolesystem.agentlogic.utilityclasses;

import java.util.concurrent.Semaphore;

public class Square 
{
	private int weight;
	private boolean reserved;
	private boolean at_destination;
	private boolean blocked;
	
	//private static Semaphore semaphore;

	public Square()
	{
		this.weight=0;
		this.reserved=false;
		this.at_destination=false;
		this.blocked=false;
	}
	
	public synchronized int getWeight()
	{
		return weight;
	}
	
	public synchronized void setWeight(int weight)
	{
		this.weight=weight;
	}
	
	public synchronized boolean getReserved()
	{
		return reserved;
	}
	
	public synchronized void setReserved(boolean reserved)
	{
		this.reserved=reserved;
	}
	
	public synchronized boolean getReservedAndSetIfFalse()
	{
		if(reserved==false)
		{
			reserved=true;
			return false;
		}
		else
		{
			return true;
		}		
	}

	public synchronized boolean getAtDestination()
	{
		return at_destination;
	}
	
	public synchronized void setAtDestination(boolean at_destination)
	{
		this.at_destination=at_destination;
	}
	
	public synchronized boolean getBlocked()
	{
		return blocked;
	}
	
	public synchronized void setBlocked(boolean blocked)
	{
		this.blocked=blocked;
	}
}
